package co.fitstart.api.dao;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.demo2do.core.persistence.GenericDaoSupport;

import co.fitstart.entity.report.VisitorReport;
import co.fitstart.entity.site.Site;

/**
 * 
 * @author dan
 *
 */
@Repository("reportDaoSupport")
public class ReportDaoSupport {
    
    @Autowired
    private GenericDaoSupport genericDaoSupport;
    
    /**
     * 
     * @param site
     * @param occurDate
     * @return
     */
    public VisitorReport loadVisitorReport(Site site, Date occurDate) {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("site", site);
        parameters.put("occurDate", occurDate);
        
        return genericDaoSupport.searchForObject("FROM VisitorReport WHERE site = :site AND occurDate = :occurDate", parameters, VisitorReport.class);
    }

}
